package org.adorsys.aderp.om.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaEntity
public class ReturnNote {

    @NotNull
    @Column(name = "returnNoteKeyBk", unique = true)
    private String returnNoteKey;

    private String title;

    private String comment;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date returnDate;

    @NotNull
    @ManyToMany(cascade = CascadeType.ALL)
    private Set<SalesOrder> salesOrders = new HashSet<SalesOrder>();

    @NotNull
    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Invoice> invoices = new HashSet<Invoice>();

    @ManyToOne
    private Customer customer;

    @ManyToOne
    private OrgaPersonRef agencyRef;
}
